/**
 * 格式化日期
 */
Date.prototype.Format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1,                 //月份
        "d+": this.getDate(),                    //日
        "h+": this.getHours(),                   //小时
        "m+": this.getMinutes(),                 //分
        "s+": this.getSeconds(),                 //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds()             //毫秒
    };
    if (/(y+)/.test(fmt))
        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt))
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
};

//截取字符串后边用...标识
function operateOpinionFormatter(value, row, index) {
    if (value.length > 20) {
        return "<span title='" + value + "'>" + value.substring(0, 20) + "..." + "</span>";
    } else {
        return "<span title='" + value + "'>" + value.substring(0, value.length) + "</span>";
    }
}

function formatTableUnit(value, row, index) {
    return {
        css: {
            "overflow": 'hidden',
            "text-overflow": 'ellipsis',
            "white-space": 'nowrap'
        }
    };
}

//判断字符串是否为空
function isNull(value) {
    if (value == null || value == undefined || value == "") {
        return true;
    }
    return false;
}


//字符串拼接
/**
 * @Description: 字符串拼接
 * @CreateTime: 2014-1-18 下午2:42:35
 * @author: chenzw
 * @version V1.0
 */
function StringBulider() {
    this.data = new Array();
}

/**
 * 拼接字符串,可以连续拼接
 * @return {}
 */
StringBulider.prototype.append = function () {
    this.data.push(arguments[0]);
    return this;
};

/**
 * 转成字符串输出
 * @return {}
 */
StringBulider.prototype.toString = function () {
    if (arguments.length > 0) {
        return this.data.join(arguments[0]);
    }
    else {
        return this.data.join('');
    }
};

/**
 * 判断字符串数组是否为空
 * @return {}
 */
StringBulider.prototype.isEmpty = function () {
    return this.data.length <= 0;
};

/**
 * 清空字符串数组
 */
StringBulider.prototype.clear = function () {
    this.data = [];
    this.data.length = 0;
};
//替换字符串占位符
String.prototype.format = function () {
    if (arguments.length == 0) return this;
    for (var s = this, i = 0; i < arguments.length; i++)
        s = s.replace(new RegExp("\\{" + i + "\\}", "g"), arguments[i]);
    return s;
};



/*map的操作*/
function Map() {
    this.data = {};
}
Map.prototype.put = function (key,value) {
    this.data[key]=value;
};
Map.prototype.delete = function (key) {
    delete this.data[key];
};

